/**
* @author AlbertDarren
* @contact 2563491540@qq.com
*/
#include <cstdio>

using namespace std;

int main_1037_2()
{
    int P[3],A[3],Pk=0,Ak=0,extra=0,level1=17*29,level2=29;
    scanf("%d.%d.%d %d.%d.%d",&P[0],&P[1],&P[2],&A[0],&A[1],&A[2]);
    Ak=A[0]*level1+A[1]*level2+A[2];
    Pk=P[0]*level1+P[1]*level2+P[2];
    extra=Ak-Pk;
    if (extra>0)
    {
        printf("%d.%d.%d",extra/level1,(extra%level1)/level2,extra%level2);
    }
    else
    {
        printf("%d.%d.%d",extra/level1,-(extra%level1)/level2,-extra%level2);
    }
	return 0;
}
